Visual Basic 2010 Fractal Galaxy Program: "VB2010 FGalaxy PP"

The programs VB2010 FGalaxy PP are in Visual Basic 2010 which uses the concept of a Mandelbrot Set to simulate the Universe consisting of Fractal Galaxies.
Using the mouse you can select different parts of this Universe, enlarge the dipslay and new galaxies will appear ad infinitum.

The program "VB2010 FGalaxy PP" is identical as the program "VB2010 FGalaxy". The only difference is that the first uses Parallel Programming and the second not.
For all basic information select Program: VB2010 FGalaxy

This same functionality is also implemented using Visual Basic 5.0. To get more information go to: Visual Basic 5.0 Fractal Galaxy Program: "VB FGalaxy.bas"

For an explanation of the Mandelbrot Set See: Mandelbrot Set

To travel through this Fractal Universe select the following picture.

FGalaxy
In total there are 13 pictures. Each picture is an enlargement with a factor of 10. The part that is enlarged is in the center.


VB Program: "VB2010 FGalaxy PP" Operation

The program contains three forms: A Control Form, a Display Form and a Monitor Form
The Control Form is used to control the program. The Display Form shows the result of the simulation. The Monitor Form shows the state of Parallel Programming.
FGalaxy The Control Form contains 3 commands: Start, End and Stop
  • The Start Command is used to start the simulation.
    After the Start Command is selected the End Command changes into Stop Command
    At the end of the simulation the Stop Command changes back into End Command
  • The End Command is used to terminate the program.
  • The Stop Command is used to terminate a specific simulation.


VB Program: "VB2010 FGalaxy PP" Operation

The operation of the program VB2010 FGalaxy PP is identical as the operation of the program VB2010 FGalaxy except that the Control Form uses two more parameters: npreq and np

VB Program: "VB2010 FGalaxy PP" source

  • "VB2010 FGalaxy PP" Application listings


  • Visual Basic Program: "VB2010 FGalaxy PP"

    This program is functional the same as VB2010 FGalaxy except it uses the concept of Parallel Programming. Parallel Programming means that more processors are used in Parallel. For a discussion about parallel programming with Visual Basic 2010 go here: Visual Basic 2010 Parallel Programming techniques
    Following is a more or less step by step description which modifications are involved starting from the program "VB2010 FGalaxy".
    1. To understand what is involved go to the subroutine MAIN. This is the central part of the Fractal Galaxy program. In this subroutine the pixels of the picture are calculated.
      The central part of the subroutine Main are two loops:
      An outer loop with the paramater Y and an innerloop with the parameter X
      • The outerloop parameter Y defines the vertical position (height) in pixels of the bitmap.
      • The innerloop parameter X defines the horizontal position (width) in pixels of the bitmap.
      The idea is to perform all the calculations of the innerloop in one processor. That means the basic parameter to control what each processor is supposed to do is the parameter Y.
    2. The program requires 3 Backgroundworkers: Backgroundworker1, Backgroundworker2 and Backgroundworker3.
      Those 3 Backgroundworkers are created as part of Form1
      Each of the Backgroudworkers requires an event handler. For Backgroundworker1 this is subroutine: BackgroundWorker1_DoWork. It is important to indicate that this subroutine handles BackgroundWorker1.Dowork
    3. The following variables (arrays) are new:
      1. state() The state array is used as communication between the master and the slave
        The following commands are used: 1 = Start req state. 2 = Active state. 3 = Cancel req state. 4 = Stop state. 5 = End state .
      2. anin() This array contains the requested Y parameter i.e. height parameter of the bitmap.
      3. anout() This array contains the X parameter i.e. width parameter of the bitmap. The value is calculated in the slave. This array is used in the Monitor Form
      4. npreq The number of requested processors. Used by the subroutines Asign and Cancel.
      5. np The number of active processors. Used by the subroutines Asign and Cancel. In this application the parameter np is not used by the slave/Background workers.
      6. pp This parameter is a constant to identify the processor number. In the subroutine Main the value is 1. In Backgroundworker-1 the value is 2. etc. The parameter pp is used specific for the arrays: state(), anin() and anout()
    4. The subroutine Asign is used to start the 3 BackGroundworkers.
    5. The subroutine Cancel is used to release the 3 Backgroundworkers


    Performance Pentium P4 and Intel Core i5

    Two CPU's are tested: 1) The Pentium 4 2.80 GHz and 2) Intel Core i5 M 460 @2.53 GHz with 4 Processors.
    Three bitmaps were tested: With 500 pixels, with 1000 pixels and with 1500 pixels (all square)
    Two types screen updates were tested: Two types of pictures were tested: Following are the results.
    1. Start up display. Amplification 1. Counter max = 569 1 Update per line.
      Size P4 1 2 3 4
      500 27.3 9.53 7.78 5.25 4.08
      1000 61.535.1023.6318.9315.66
      1500101.263.2846.8334.7529.53
    2. Start up display. Amplification 1. Counter max = 569 1 Update per display.
      Size P4 1 2 3 4
      500 1.73 1.93 3.88 2.60 2.16
      1000 6.42 7.23 8.20 9.84 7.89
      150014.2316.03 23.3017.7817.51
    3. Display with Amplification 1000000000. Counter max = 1651. 1 Update per display
      Size P4 1 2 3 4
      500 8.21 11.79 8.04 7.126.09
      100032.84 46.8327.0625.3622.02
      150073.37104.6760.9853.3250.15


    Reflection


    Feedback

    No feedback received.


    First Release: 4 July 2012
    Updated 8 Augustus 2013

    Back to my home page Contents of This Document